<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
		<title>导游管理</title>

		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="__INDEX__/css/bootstrap.min.css">

		<!-- Fontawesome CSS --> 
		<link rel="stylesheet" href="__INDEX__/plugins/fontawesome/css/fontawesome.min.css">
		<link rel="stylesheet" href="__INDEX__/plugins/fontawesome/css/all.min.css">

		<!-- calendar CSS -->
		<link rel="stylesheet" href="__INDEX__/plugins/simple-calendar/simple-calendar.css">

		<!-- Feathericon CSS -->
		<link rel="stylesheet" href="__INDEX__/css/feather.css">

		<!-- Main CSS -->
		<link rel="stylesheet" href="__INDEX__/css/style.css">
	</head>
	<body>
		<!-- Main Wrapper -->
		<div class="main-wrapper">
			<!-- Header -->
			{include file="Include/top"}
			<!-- /Header -->

			<!-- Sidebar -->
			{include file="Include/left"}
			<!-- /Sidebar -->

			<!-- Page Wrapper -->
			<div class="page-wrapper">
				<div class="content container-fluid">
					<div class="card">
						<div class="card-header no-border">
							<form action="/admin.php/index/index" method="get" autocomplete="off">
								<div class="form-group row">
									<div class="col-md-10">
										<h4 class="card-title float-left" style="margin: 0.8em 0 0 0;">导游信息</h4>
										<input type="text" name="name" value="{$name|default=''}" class="form-control" placeholder="请输入导游名称" style="width:70em;display:inline;margin: 0 0 0 3em;">
										<button type="submit" class="btn btn-primary" style="height: 48px;margin-left:10px;">搜索</button>
									</div>
								</div>
							</form>
						</div>

						<div class="card-body">

							<div class="table-responsive">

								<table class="table mb-0">
									<thead>
										<tr>
											<th>ID</th>
											<th>姓名</th>
											<th>手机</th>
											<th>导游证件号</th>
											<th>公司</th>
											<th>注册时间</th>
											<th>状态</th>
											<th class="text-right">操作</th>
										</tr>
									</thead>
									<tbody>
									{volist name="list" id="vv"}
										<tr>
											<td>{$vv.id}</td>
											<td>{$vv.dyname}</td>
											<td>{$vv.dyiphone}</td>
											<td>{$vv.zhengjian}</td>
											<td>{$vv.company}</td>
											<td>{$vv.dyaddtime|date="Y-m-d H-i-s"}</td>
											<td class="text-success">
												{if condition="$vv.stutic eq 1"}
												<button type="button" class="btn btn-info" onclick="clockbtn1(this,'{$vv.id}')">启用</button>
												{else}
												<button type="button" class="btn btn-dark" onclick="clockbtn2(this,'{$vv.id}')">停用</button>
												{/if}
											</td>
											<td class="text-right">
												<a href="/admin.php/index/edit?id={$vv.id}" class="btn btn-sm btn-white text-success mr-2"><i class="far fa-edit mr-1"></i> 修改</a>
<!--												<a href="javascript:void(0);"  onclick="member_del(this,'{$vv.id}');"  class="btn btn-sm btn-white text-danger mr-2"><i class="far fa-trash-alt mr-1"></i>删除</a>-->
											</td>
										</tr>
									{/volist}
									</tbody>
								</table>
							</div>
							<div class="row" style="margin-left: 85%;height: 45px;width:100%;">
								<div class="btn btn-default col-xs-12 col-sm-6 col-md-8">
									{$list|raw}
								</div>
							</div>

						</div>
					</div>
				</div>
			</div>
			<!-- /Page Wrapper -->

			<!-- Notification -->
			<!-- /Notification -->
		</div>
		<!-- /Main Wrapper -->
		<script>
			function member_del(obj, id){
				$.ajax({
					url:'del',
					type: 'get',
					data: {'id':id},
					dataType: 'json',
					success:function(res){
						if(res.code == 1){
							success(res);
						}else{
							console.log('success', res);
						}
					},
					fail:function(res){
						console.log('成功但响应出错', res)
					}
				})
			}
		</script>
		<script>
			function clockbtn2(obj,id){
				$.ajax({
					url:'edit_stutic',
					type: 'post',
					data: {'id':id},
					dataType: 'json',
					success:function(res){
						if(res.code == 1){
							$(obj).html('启用');
							$(obj).attr('class', 'btn btn-info');
							$(obj).attr('onclick', '').unbind('click').click( function () { clockbtn1(obj,id); });
						}else{
							console.log('success', res);
						}
					},
					fail:function(res){
						console.log('成功但响应出错', res)
					}

				})
			}
		</script>
		<script>
			function clockbtn1(obj,id){
				$.ajax({
					url:'edit_stutic',
					type: 'post',
					data: {'id':id},
					dataType: 'json',
					success:function(res){
						if(res.code == 1){
							$(obj).html('停用');
							$(obj).attr('class', 'btn btn-dark');
							$(obj).attr('onclick', '').unbind('click').click( function () { clockbtn2(obj,id); });
						}else{
							console.log('success', res);
						}
					},
					fail:function(res){
						console.log('成功但响应出错', res)
					}

				})
			}
		</script>
		<!-- jQuery -->
		<script src="__INDEX__/js/jquery-3.6.0.min.js"></script>

		<!-- Bootstrap Core JS -->
		<script src="__INDEX__/js/bootstrap.bundle.min.js"></script>

		<!-- Slimscroll JS -->
		<script src="__INDEX__/plugins/slimscroll/jquery.slimscroll.min.js"></script>

		<!-- Chart JS -->
		<script src="__INDEX__/plugins/apexchart/apexcharts.min.js"></script>
		<script src="__INDEX__/plugins/apexchart/dsh-apaxcharts.js"></script>

		<!-- calendar Js -->
		<script src="__INDEX__/plugins/simple-calendar/jquery.simple-calendar.js"></script>
		<script src="__INDEX__/js/calander.js"></script>

		<!-- Custom JS -->
		<script  src="__INDEX__/js/script.js"></script>
	</body>
</html>
